package server;

public class RemoveDeadClientsThread extends Thread
{
	
	public void run()
	{
		while(true)
		{
			try
			{
				Thread.sleep(115005);
			} catch (InterruptedException e)
			{
				Server.gui.writeLog("RemoveDeadClientsThread interrupted");
			}
			Server.gui.writeLog("removing dead clients...");
			//remove all clients which haven't talked to this recently
			long now = System.currentTimeMillis();
			Server.clientList.removeDeadClients(now);
			/*for(int i = 0; i < Server.clients.size(); i++)
			{
				if(Server.clients.get(i).dieAt < now)
				{
					Server.clients.remove(i);
				}
			}*/
			/*for (Client c : Server.clients)
			{
				if(c.dieAt < now)
				{
					Server.clients.remove();
				}
			}*/
		}
	}

}
